const joi = require('joi')
const username = joi.string().alphanum().min(1).max(10).required()
const password = joi.string().pattern(/^\S{6,12}$/).required()
const id = joi.number().integer().min(1).required()
const nicname = joi.string().required()
const email = joi.string().email().required()
const avatar = joi.string().dataUri().required()
const securityQuestion = joi.string().min(1).max(100).required();
const securityAnswer = joi.string().min(1).max(100).required();
exports.reg_schema = {

  body: {
    username,
    password,
    securityQuestion, // 新增
    securityAnswer    // 新增
  }

}
exports.update_userinfo_schema = {
  body: {
    id,
    nicname,
    email
  }
}
exports.update_password_schema = {
  body: {
    oldPwd: password,
    newPwd: joi.not(joi.ref('oldPwd')).concat(password)
  }
}
exports.update_avatar_schema = {
  body: {
    avatar
  }
}